package edu.vt.ece_3574.amber_alert.location;

import android.content.Context;
import android.location.Location;
import android.location.LocationListener;
import android.location.LocationManager;
import android.os.Bundle;
import edu.vt.ece_3574.amber_alert.AmberAlertApplication;

public class LocationManagerHandler {
	private static LocationManager locationManager;
	
	public static LocationManager getLocationManager() {
		if (locationManager == null) {
			start();
		}
		return locationManager;
	}

	public static void start() {
		locationManager = (LocationManager) AmberAlertApplication.getContext().getSystemService(Context.LOCATION_SERVICE);

		LocationListener locationListener = new LocationListener() {
			public void onStatusChanged(String provider, int status, Bundle extras) {
			}

			public void onProviderEnabled(String provider) {
			}

			public void onProviderDisabled(String provider) {
			}

			public void onLocationChanged(Location location) {
			}
		};
		
		locationManager.requestLocationUpdates(LocationManager.GPS_PROVIDER, 0, 0, locationListener);
	}
}
